<script>
$(document).ready(function() {
	calendrier_raids_charger(<? echo mktime(0,0,0); ?>);
});
</script>
<div class='accordion'>
	<h3><a href="#">Composition</a></h3>
	<div id='calendrier_raids_main' style='position: relative;'>
		<div id='calendrier_raids_left'>
			<div id='calendrier_raids_calendrier'>
				<table>
					<tr>
						<td style='text-align: left;'><div class='div-icon ui-state-default ui-corner-all pointer tooltip' title='Mois précédent' onclick="window.open('<?php echo CFG_REP_INSTALL."admin?confmodule=calendrier_raids&ts=".mktime(0,0,0,date("n",$ts)-1,1,date("Y",$ts)); ?>','_self');"><span class="ui-icon ui-icon-circle-arrow-w"></span></div></td>
						<td style='text-align: center;'><?php echo util_getMois(date("n",$ts)); ?></td>
						<td style='text-align: right;'><div class='div-icon ui-state-default ui-corner-all pointer tooltip' title='Mois suivant' onclick="window.open('<?php echo CFG_REP_INSTALL."admin?confmodule=calendrier_raids&ts=".mktime(0,0,0,date("n",$ts)+1,1,date("Y",$ts)); ?>','_self');"><span class="ui-icon ui-icon-circle-arrow-e"></span></div></td>
					</tr>
				</table>
				<table id='calendrier' cellpadding="0" cellspacing="0">
					<tr>
					<? $fin=0;
					$i=0;
					$nbj=0;
					for ($j=0;$j<$jour_deb;$j++){
						echo "<td><div class='calendrier_jour_off'></div></td>\n";
						$i++;
					}
					
							
					while($fin==0){
						$nbj++;
	
						$ts2=mktime(0,0,0,date("n",$ts),$nbj,date("Y",$ts));
						
						?>
						<td>
							<div class="calendrier_jour">
								<div class="calendrier_jour_n" id='j<? echo $ts2; ?>' onclick='calendrier_raids_charger(<? echo $ts2; ?>);'><? echo $nbj; ?></div>
							</div>
						</td>
						<?
						$i++;
						if(($i%7)==0) echo "</tr><tr>\n";
						if ($nbj==$nb_jours) $fin=1;
					}
					if(($i%7)>0){
						for($j=0;$j<(7-($i%7));$j++){
							echo "<td><div class='calendrier_jour_off'></td>\n";
						}
					}
					?>
					</tr>
				</table>
			</div>
			<div id='calendrier_raids_dispos'>
			</div>
		</div>
		<div id='calendrier_raids_data'></div>
	</div>
	<h3><a href="#">Configuration</a></h3>
	<div>
		<form name='formAdminCalendrierRaids' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<tr class='tr1'>
					<td style='width: 250px;'>Afficher les disponibilités : </td>
					<td>
						
						<div class='calendrier_raids_disposTypes'>
							<?
							$liste_dispos=util_makeArray($GLOBALS["CONFIG"]["calendrier_raids"]["liste_dispos"],","); 
							$types=explode("|",$GLOBALS["CONFIG"]["dispos"]["types"]);
							foreach($types as $i=>$type){
								if($type!=""){
									$type=explode(";",$type);
								?>
							<div class='calendrier_raids_disposTypesItem'>
								<table cellspacing='0' cellpadding='1'>
									<tr>
										<td>
											<input type='hidden' class='nom' value='<?php echo $i; ?>' />
											<? echo $type[0]; ?>
										</td>
										<td style='width: 17px; border-left: 1px solid #000000;'>
											<div style='width: 17px; height: 17px; background-color: <? echo $type[1]; ?>;'></div>
										</td>
										<td style='width: 10px; border-width: 0px; border-left: 1px solid #000000;' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' onclick='calendrier_raidsDisposToggle(this);'>
											<span class="ui-icon ui-icon-<?php if(in_array($i,$liste_dispos)) echo "check"; else echo "minus";?> tooltip" title='Afficher ce type de dispos'></span>
										</td>
									</tr>
								</table>
							</div>
								<? }
							}?>
						</div>
						<input type='hidden' name='cfg_liste_dispos' id='cfg_liste_dispos' value='<?php echo $GLOBALS["CONFIG"]["calendrier_raids"]["liste_dispos"]; ?>' />
					</td>
				</tr>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick='open_loading(); document.formAdminCalendrierRaids.submit();' class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_configuration' />
		</form>
	</div>
</div>